package com.test.controller;


import com.test.service.imageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;

@RestController
@RequestMapping("/image")
public class imageController {
    @Autowired
    public imageService  imageService;
    @RequestMapping("/getCheckCode")
    public void getcheckcode(HttpServletResponse response, HttpServletRequest request)throws IOException {
        BufferedImage bi = imageService.getimgYZM(request);
        ImageIO.write(bi, "JPG", response.getOutputStream());

    }
}
